#include "Goal_ArriveAtDestination.h"
#include "Message Dispatcher.h"
#include "Goal_Types.h"
#include "ExecutionLog.h"

Goal_ArriveAtDestination::Goal_ArriveAtDestination(Character *owner, Vector2D dest):Goal<Character>(owner, goal_arrive_at_destination),
																					m_vDestination(dest)
{
}


void Goal_ArriveAtDestination::Activate()
{
	m_pOwner->SetArriveDestination(m_vDestination);
	m_iStatus = active;
}

int Goal_ArriveAtDestination::Process()
{
	ActivateIfInactive();

	if(m_pOwner->Pos().DistanceSq(m_vDestination) < 6400)
		m_iStatus = completed;

	return m_iStatus;
}

void Goal_ArriveAtDestination::Terminate()
{
	m_pOwner->StopArriving();
}

